//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Text;
using OpenLS.Spreadsheet.Expressions;

namespace OpenLS.Spreadsheet.Parsing
{
    abstract class MultiSheetExpression: CellEnumeratorExpression
    {
        protected MultiSheetExpression(List<Worksheet> worksheets)
        {
            Contract.Requires(worksheets != null);
            _worksheets = worksheets;
        }
        public override Worksheet Worksheet
        {
            get { throw new NotImplementedException(); }
        }

        protected readonly List<Worksheet> _worksheets;
        protected string WorksheetsText
        {get
        {
            return StringEnumerable.Concat(_worksheets, ww => ww.SafeName, ":");
            StringBuilder builder = new StringBuilder();
            var lastWorksheet = this._worksheets[_worksheets.Count - 1];
            foreach (var worksheet in _worksheets)
            {
                builder.Append(worksheet.SafeName);
                if (worksheet != lastWorksheet)
                    builder.Append(":");
            }
            return builder.ToString();

        }}
    }
}